<template>
    <a-card :bordered="false">
        <div class="table-operator">
            
        </div>
        <LTable
            ref="instanceList"
            size="middle"
            rowKey="id"
            :formAttributes="formAttributes"
            :columns="columns"
            axiosUrl="/flowInstance/list"
            :showPagination="true"
         
            :showQueryForm="true">

            <span slot="action" slot-scope="text, record">
                <a @click="handleTask(record)">查看任务</a>
            </span>

        </LTable>

        <drawer-task ref="taskModeler"></drawer-task>
    </a-card>
</template>

<script>
import LTable from '@/components/lt/LTable' 
import request from '@/utils/flowRequest'
import {SysMixin} from '@/mixins/SysMixin'
import drawerTask from './drawerTask';

export default {
    name:'instanceList',
    components:{
       LTable, drawerTask
    },
    mixins:[SysMixin],
    data() {
        return {
            request,
            url: {
                task: '/flowInstance/instanceTask',
                delete: '/actReModel/deleteModel'
            },
            formAttributes:[
                {field:'systemNo',label:'系统编号',component:'input',condition:'like'},
                {field:'templateName',label:'模板名称',component:'input',condition:'like'}
            ],

            columns:[
                {
                    title: '#',
                    dataIndex: '',
                    key:'rowIndex',
                    width:60,
                    align:"center",
                    customRender:function (t,r,index) {
                      return parseInt(index)+1;
                    }
                },
                // {
                //     title: '流程实例ID',
                //     dataIndex: 'procInstId'
                // },
                {
                    title: '系统编号',
                    dataIndex: 'systemNo'
                },
                {
                    title: '模板名称',
                    dataIndex: 'templateName'
                },
                {
                    title: '业务内码',
                    dataIndex: 'businessKey'
                    
                },
                {
                    title: '流程发起人编号',
                    dataIndex: 'startUserId'
                },
                {
                    title: '流程开始时间',
                    dataIndex: 'startTime'
                },
                {
                    title: '流程结束时间',
                    dataIndex: 'endTime'
                },
                {
                    title: '操作',
                    dataIndex: 'action',
                    width: '220px',
                    scopedSlots: { customRender: 'action' }
                }
            ],
        } 
    },
    methods: {
        handleTask(record) {
            //record.procInstId
            this.$refs['taskModeler'].open(record.procInstId)
            
        }
    }
}
</script>
